<script setup>
import { artGetChannelsService } from '@/api/article.js'
import { ref } from 'vue'
defineProps({
  modelValue: {
    type: [Number, String]
  }
})
const emit = defineEmits(['update:modelValue'])
//存放数组中
const channelList = ref([])
const getChannelList = async () => {
  //调用方法
  const res = await artGetChannelsService()
  //res.data后台访问的结果
  channelList.value = res.data.data
}
getChannelList()
</script>

<template>
  <!-- 下拉 循环 给用户看以及提交数据-->
  <el-select :modelValue="modelValue" @update:modelValue="emit('update:modelValue', $event)">
    <el-option 
    v-for="channel in channelList" 
    :key="channel.id" 
    
    label="channel.cate_name" 
    value="channel.id"
    ></el-option>
  </el-select>
</template>